package cn.itsource.service.impl;

import cn.itsource.domain.order.vo.OrderPriceCountVO;
import cn.itsource.feign.order.OrderPriceCountFeignClient;
import cn.itsource.mapper.ShopMapper;
import cn.itsource.service.ConsoleService;
import cn.itsource.vo.ConsoleVO;
import cn.itsource.vo.EmplCountVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 这里是返回控制台的业务逻辑层
 */
@Service
public class ConsoleServiceImpl implements ConsoleService {
    @Autowired
    ShopMapper shopMapper;
    @Autowired
    OrderPriceCountFeignClient orderPriceCountFeignClient;



    @Override
    public ConsoleVO getConsoleData() {
        //1.查询公司对应的员工数量 前五
        List<EmplCountVO> emplCountVOs = shopMapper.getEmployeeCount();
        //2.查询公司对应订单金额数量 前五
        List<OrderPriceCountVO> orderPriceCountVOs = orderPriceCountFeignClient.orderPriceCount();
        return new ConsoleVO(emplCountVOs,orderPriceCountVOs);
    }
}
